package com.health.userbackstage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.health.userbackstage.pojo.User;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author ASUS
 * @Date 2023/8/18 21:18
 * @Version 1.0
 */
public interface UserMapper extends BaseMapper<User> {

    @Select("SELECT r.`keyword` rname\n" +
            "FROM `user` u,user_role ur,role r\n" +
            "WHERE u.id=ur.user_id AND ur.role_id=r.`id` AND username=#{username}")
    List<String> findRoleNamesByUsername(String username);

    @Select("select * from user where username = #{username}")
    User findUserByUsername(String username);

}
